package com.touchfired.common.exception;

import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = false)
public class ServiceException extends RuntimeException{

    /** 异常码 */
    private int code;

    /** 异常描述 */
    private String desc;

    public ServiceException(ErrorCode errorCode) {
        if (errorCode != null) {
            this.code = errorCode.getCode();
            this.desc = errorCode.getDesc();
        }
    }

    public ServiceException(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }
}
